package org.itboys.site;

import org.itboys.weixin.constant.WeixinConstants;
import org.itboys.weixin.entity.WeixinConfig;
import org.itboys.weixin.service.WeixinConfigService;
import org.itboys.weixin.tools.WeixinUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"/applicationContext.xml"})
public class CreateSceneTwoCode {

	@Autowired
	private WeixinConfigService weixinConfigService;
	
	@Test
	public void test(){
		WeixinConfig wc = weixinConfigService.getById(1L);
		String appid = wc.getAppId();
		String secret = wc.getAppSecret();
		String access_token = WeixinUtils.getAccessToken(appid, secret);
		String ticket = WeixinUtils.getTicket(access_token, WeixinConstants.TOW_CODE_TYPE.QR_LIMIT_SCENE, 65L);
		System.out.println("================="+WeixinConstants.URL.GET_TOWCODE_URL + ticket);
	}
}
